//
//  ThirdTwoViewController.m
//  UI_Lesson11.homework
//
//  Created by dllo on 15/11/10.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "ThirdTwoViewController.h"

@interface ThirdTwoViewController ()

@property (nonatomic, retain) UITextField *textField;

@end

@implementation ThirdTwoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    UISegmentedControl *seg = [[UISegmentedControl alloc] initWithItems:@[@"消息",@"电话"]];
    seg.frame = CGRectMake(0, 0, 150, 30);
    self.navigationItem.titleView = seg;
    
    self.navigationController.navigationBar.barTintColor = [UIColor blackColor];
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    self.textField = [[UITextField alloc] initWithFrame:CGRectMake(100, 100, 100, 30)];
    self.textField.borderStyle = UITextBorderStyleRoundedRect;
    [self.view addSubview:_textField];
    
    _textField.text = self.str;
    
    
    
    [_textField release];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    button.frame = CGRectMake(80, 200, 100, 30);
    [self.view addSubview:button];
    [button setTitle:@"返回" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(button:) forControlEvents:UIControlEventTouchUpInside];
    
}
- (void)button:(UIButton *)button
{
    
    [self.delegate passValue:_textField.text];
    
    self.block();
    
    
    [self.navigationController popViewControllerAnimated:YES];
    
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
